$("#announcement").click(function (){
    var announce_data={
       "userID": localStorage.getItem("userid"),
       "announce_type": $("#announce_type").val(),
       "announce_content": $("#txtarea1").val()
   };
    announce_data = JSON.stringify(announce_data);

    $.ajax({
       url: "/announcement",
       type: "POST",
       contentType: 'application/json; charset=UTF-8',
       data: announce_data,
       success: function(errorID){
          switch(errorID){
             case '0':
                window.alert("发送失败");
                break;
             case '1':
                window.alert("发送成功");
                break;
             default:
                window.alert("系统错误");
          }
       },
       error: function() {
           window.alert("连接失败");
       }
   });
})